package com.jing.cloud.service.group.method;

import com.jing.cloud.service.group.bean.Group;
import com.jing.cloud.service.group.helper.GroupHelper;
import com.jing.cloud.service.group.method.param.GroupsBean;
import com.jing.cloud.service.method.AbstractMethod;
import com.jing.cloud.service.method.Method;
import com.jing.cloud.service.Res;
import com.jing.cloud.util.RspUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * Created by 29017 on 2017/9/20.
 */
@Component
public class GetGroups extends AbstractMethod<GroupsBean> implements Method<GroupsBean> {

    @Autowired
    private GroupHelper groupHelper;

    @Override
    public Res call(GroupsBean groupsBean) throws Exception {
        List<Group> groups = groupHelper.getGroupsByIds(groupsBean.getIds());
        return RspUtil.success(groups);
    }
}
